package jisuanji;

import java.awt.geom.Rectangle2D;
import java.awt.Shape;

public class Square extends MyShape {
    private double side;
    
    public Square(double s) {
        super("正方形");
        side = s;
    }
    
    @Override
    public double getArea() {
        return side * side;
    }
    
    @Override
    public double getPerimeter() {
        return 4 * side;
    }
    
    @Override
    public Shape getRealShape() {
        return new Rectangle2D.Double(0, 0, side, side);
    }
}